Many electrical circuits employ oscillators to generate periodic signals (e.g., clock signals) for use in synchronizing various portions of the circuits or for other timing purposes. In circuits where power consumption is a concern, oscillators can be turned off during periods in which the corresponding clock signals are not needed (e.g., when circuit portions to which the clock signals are connected are inactive), and other portions of the circuit can be either turned off or transitioned to reduced-power modes (e.g., sleep modes). Once turned off or transitioned to a reduced-power mode, a circuit may not be able to respond to external events in the same manner as the circuit responds when it is in a fully powered mode. As such, it can be advantageous to periodically “wake up” the circuit portions that have been turned off or transitioned to reduced-power modes, in order, for example, to allow the circuit portions to appropriately respond to external events that may have occurred while the circuit portions were off or in reduced-power modes. To enable the circuit portions to be periodically woken up, a circuit can include a second oscillator that, in some implementations, is always running (e.g., a sleep clock).
In some conventional applications, a second oscillator can be included in a circuit for purposes other than waking up circuit portions. For example, a watchdog timer can be included in a circuit to detect if portions of the circuit are not properly functioning. In particular, some watchdog timers count to a predetermined terminal value and are regularly reset by circuit portions that the watchdog timer is protecting. During normal operation, the protected circuit portions periodically restart the watchdog timer such that the watchdog timer never reaches its terminal value. If the protected circuit portions stop functioning properly, the watchdog timer may not be restarted before reaching its terminal value, and reaching the terminal value can cause the watchdog timer to initiate corrective action. For example, some conventional circuits include a microcontroller that executes programming code. To protect the circuits from bugs that may otherwise lock up the microcontroller, a watchdog timer can be included that resets the microcontroller upon reaching a terminal value. During normal operation, the microcontroller can be programmed to periodically restart the watchdog timer at an interval that will prevent the watchdog timer from reaching its terminal value. If the microcontroller locks up, for example, because of an illegal instruction or a bad branch, the microcontroller will not restart the watchdog timer before the watchdog timer reaches its terminal value, and the watchdog timer can initiate a reset of the microcontroller (or other corrective action) to free the microcontroller from its locked-up condition.